<extend name="Public:base"/>

<!--侧边导航-->
<block name="aside">
	<include file="Public:aside"/>
</block>

<block name="main">

	<form id="myform" class="form-horizontal" action="{:U('Node/edit')}" method="post">
		<input type="hidden" id="id" name="id" value="{$udate['id']}" />
		<div class="form-group">
			<label class="col-sm-2 control-label">分组</label>
			<div class="col-xs-4">
				{:Form::select(array('field'=>'groupid','options'=>$groups,'options_key'=>'id,name'),$groupid)}
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">名称</label>
			<div class="col-xs-4">
				<input type="text" class="form-control" name="name" value="{$udate['name']}" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">标题</label>
			<div class="col-xs-4">
				<input type="text" name="title" class="form-control" value="{$udate['title']}"/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">上级</label>
			<div class="col-xs-4">
				<select class="form-control" name="pid">
					{$nodes}
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">描述</label>
			<div class="col-xs-4">
				<textarea  id="remark" name="remark" class="form-control" rows="3" cols="40">{$udate['remark']}</textarea>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">状态</label>
			<div class="col-xs-4">
				<input type="radio" name="status" value="1" <eq name="udate['status']" value="1">checked="checked"</eq> />启用
				<input type="radio" name="status" value="0" <eq name="udate['status']" value="0">checked="checked"</eq> />禁用
			</div>
		</div>
		<div class="form-actions">
			<input type="submit" value="{:L('dosubmit')}" class="btn btn-sm btn-primary" >
			<input type="reset" value="{:L('cancel')}" class="btn btn-sm btn-primary">
		</div>
	</form>
</div>
</block>

<block name="script">
	<script type="text/javascript">
		$(document).ready(function() {
			$('#myform').ajaxForm({
				success:  complete,  // post-submit callback
				dataType: 'json'
			});
		});

		function complete(data){
			if (data.status == 1) {
				layer.msg(data.info, {
					icon: 1,
					time: 2000 //2秒关闭（如果不配置，默认是3秒）
				}, function(){
					window.location.href = "{$Think.cookie.__forward__}";
					return true;
				});
			} else {
				layer.msg(data.info, {
					icon: 2,
					time: 2000 //2秒关闭（如果不配置，默认是3秒）
				});
			}
		}
	</script>
</block>